package com.example.shop_2207.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.shop_2207.R
import com.example.shop_2207.adapter.PayingAdapter
import com.example.shop_2207.database.MyDbUtils
import com.example.shop_2207.databinding.FragmentPayedBinding
import com.example.shop_2207.entity.CarEntity
import com.example.shop_2207.mvvm.BaseViewFragment


class PayedFragment : BaseViewFragment<FragmentPayedBinding>() {
    val list = mutableListOf<CarEntity>()
    lateinit var payingAdapter: PayingAdapter
    override fun getLayout(): Int  = R.layout.fragment_payed

    override fun initView() {
        payingAdapter = PayingAdapter(list)
        binding.rvPayed.adapter = payingAdapter
        binding.rvPayed.layoutManager = LinearLayoutManager(context)

        list.clear()
        list.addAll(MyDbUtils.getDb().getOrderDao().queryOrder(2))
        payingAdapter.notifyDataSetChanged()
    }

    override fun initData() {

    }
}